<template>
	<!-- 积分商品 -->
	<view>
		<view class="goodslist">
			<scroll-view scroll-x="true" enhanced="true" style="white-space: nowrap;">
				<view class="goods" v-for="(item,index) in goodsList" :key="index" @click="toDetail(item.id)">
					<image :src="item.cover_image" class="goods_img"></image>
					<view class="goods_info">
						<view class="goods_info_title">{{item.goods_name}}</view>
						<view class="goods_info_desc">{{item.goods_describe}}</view>
						<view class="goods_info_integral">
							<view class="integral">
								<image src="/static/images/mall/integralicon.png"></image>
								<text>{{item.point_price}}</text>
							</view>
							<text v-if="Number(item.merchant_price)>0">+</text>
							<view class="price" v-if="Number(item.merchant_price)>0">￥{{item.merchant_price}}</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"integral",
		props:{
			goodsList:{
				type:Array,
				default:()=>{
					return []
				}
			},
			goodsType:{
				type:Number | String,
				default:1
			}
		},
		methods:{
			toDetail(id){
				uni.navigateTo({
					url:`/pages/mall/goodsDetail?id=${id}&goodsType=${this.goodsType}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
view{
	box-sizing: border-box;
}
.goodslist{
	display: flex;
	
	.goods{
		background-color: #F8F8F8;
		border-radius: 10rpx;
		margin-right: 16rpx;
		display: inline-block;
		
		&:nth-child(1n){
			margin-left: 32rpx;
		}
		&:nth-child(3n){
			margin-right: 32rpx;
		}
		&_img{
			width: 280rpx;
			height: 280rpx;
			border-radius: 10rpx 10rpx 0 0;
		}
		
		&_info{
			background-color: #FBFBFB;
			padding: 24rpx;
			
			&_title{
				width: 336rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #333333;
				padding: 0 9rpx;
				@include one;
			}
			&_desc{
				width: 336rpx;
				height: 32rpx;
				font-size: 24rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #333333;
				padding: 0 7rpx;
				margin-top: 14rpx;
				@include one;
			}	
			&_integral{
				height: 30rpx;
				@include align-center;
				padding: 0 9rpx 0 7rpx;
				margin-top: 17rpx;
				
				.integral{
					@include align-center;
					font-size: 30rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FF7000;
					
					image{
						width: 34rpx;
						height: 34rpx;
						margin-right: 10rpx;
					}
					text{
						width: 200rpx;
						@include one;
					}
				}
				text{
					font-size: 24rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #333333;
				}
				.price{
					font-size: 36rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FE3E46;
					width: 180rpx;
					@include one;
					text-align: center;
				}
			}
		}
	}
}
</style>
